//
//  ApeRequest+Pay.m
//  BDD
//
//  Created by Eton on 2017/4/8.
//  Copyright © 2017年 APE. All rights reserved.
//

#import "AppRequest+Pay.h"
//#import "DepositInfoModel.h"
#import "PayParam.h"

@implementation AppRequest (Pay)

+ (RACSignal *) requestCreatePayOrder:(RACTuple *) turple{
    NSMutableDictionary * params = [NSMutableDictionary dictionary];
    [params setValue:[PayParam stringWithpayDataType:[turple.first integerValue]] forKey:@"type"];
    [params setValue:turple.second forKey:@"money_real"];
    [params setValue:turple.third forKey:@"institution_id"];
    return [AppRequest racPOST:API_Common(@"/rechargeOrder/createOrder") params:params class:[ApeModel class]];
}

+ (RACSignal *) requestPayment:(RACTuple *) turple{
    return [AppRequest racPOST:FORMAT(@"%@/pay/%@/dataType/%@/payTask/%@",API_Common(@"/payment"),turple.first,turple.second,[PayParam stringWithPayPlatformType:[turple.third integerValue]]) params:nil class:[PayParameterInfo class]];
}

+ (RACSignal *) requestRefundDeposit:(RACTuple *) turple{
    return [AppRequest racPOST:API_Common(@"/refund/dataType/deposit") params:nil class:nil];
}

+ (RACSignal *) requestRefundInstitutionDeposit:(RACTuple *) turple{
    return [AppRequest racPOST:API_Common(@"/refund/institution/ins_deposit") params:nil class:nil];
}

+ (RACSignal *) requestPaymentBalance:(RACTuple *) turple{
    PayDataType dataType = [turple.first integerValue];
    if (dataType == PayDataType_INS_VIP3 || dataType == PayDataType_INS_VIP6 || dataType == PayDataType_INS_VIP12) {
        dataType = PayDataType_INS_VIP1;
    }
    NSMutableDictionary * params = [NSMutableDictionary new];
    [params setValue:@(dataType) forKey:@"data_type"];
    [params setValue:turple.second forKey:@"order_id"];
    
    return [AppRequest racPOST:API_Common(@"/paymentBalance/payIns") params:params class:nil];
}

//+ (RACSignal *) requestGetUserAccountDepositInfo:(RACTuple *) turple{
//    return [AppRequest racPOST:API_Common(@"/refund/userAccount/depositInfo") params:nil class:[DepositInfoModel class]];
//}
//
//+ (RACSignal *) requestGetOrgDepositInfo:(RACTuple *) turple{
//    return [AppRequest racPOST:API_Common(@"/org/depositInfo") params:nil class:[DepositInfoModel class]];
//}


@end
